#include <occi.h>
#include <string.h>
#include <iostream>
//CC -L$ORACLE_HOME/lib -I$ORACLE_HOME/rdbms/public -locci -lclntsh new.C

using namespace oracle::occi;
using namespace std;

int main(void){
const char *userName = "odm";
const char *password = "odm";
const char *connstr = "dbdwex.world";

Environment *env  = Environment::createEnvironment();
Connection  *conn = env->createConnection(userName, password, connstr);
Statement   *stmt = conn->createStatement();

	cout << "Connected.";

	 
	ResultSet *rs = stmt->executeQuery("SELECT attr_name, attr_order FROM odm.odm_t_document_type_attributes order by 2");
	// ResultSet class:
	// http://docs.oracle.com/cd/E11882_01/appdev.112/e10764/reference027.htm#sthref879

	cout << "The config is:" << endl;

	while (rs->next())
	{
	   string param_name  = rs->getString(1);     // get the first column as string
	   int param_order = rs->getInt(2);        // get the second column as int

	   cout << param_name << "\t" << param_order << endl;
	}

		
		cout << "Disconnecting";

   
env->terminateConnection(conn);
Environment::terminateEnvironment(env);

cout << "Disconnected.";
return 0;
}
